package nodes;


import java.util.List;

import compiler.Compiler;
import compiler.SymbolTable;

import descriptors.AbstractDescr;

public class DeclarationsNode extends AbstractNode {

	private List<ConstNode> constNodes;
	
	private List<TypeNode> typeNodes;
	
	private List<VarNode> varNodes;
	
	private List<ProcedureDeclarationNode> procDeclNodes;
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public DeclarationsNode(List<ConstNode> constNodes,List<TypeNode> typeNodes,List<VarNode> varNodes,List<ProcedureDeclarationNode> procDeclNodes,int line,int column){
		super(line,column);
		this.constNodes=constNodes;
		this.typeNodes=typeNodes;
		this.varNodes=varNodes;
		this.procDeclNodes=procDeclNodes;
	}
	
	@Override
	public AbstractDescr compile(
			SymbolTable symbolTable, Compiler compiler) {
		for(ConstNode node:constNodes){
			node.compile(symbolTable, compiler);
		}
		for(TypeNode node:typeNodes){
			node.compile(symbolTable, compiler);
		}
		for(VarNode node:varNodes){
			node.compile(symbolTable, compiler);
		}
		for(ProcedureDeclarationNode node:procDeclNodes){
			node.compile(symbolTable, compiler);
		}
		return null;
	}

	@Override
	public void print() {
		trace("DeclarationsNode");
		for(AbstractNode node:constNodes){
			node.print();
		}
		for(AbstractNode node:typeNodes){
			node.print();
		}
		for(AbstractNode node:varNodes){
			node.print();
		}
		for(AbstractNode node:procDeclNodes){
			node.print();
		}
		unindent();
	}

}
